package com.duruikang.LeaveAPI.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.duruikang.LeaveAPI.entity.Student;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

/**
 * @author Drik
 * @date 2021-12-17 16:52
 */

public interface StudentDao extends BaseMapper<Student> {
    /**
     * 查询学生的个人信息
     * @param accountId
     * @return 学生的个人信息
     */
    @Select("   SELECT " +
            "   student.student_code, " +
            "   (SELECT sort.name FROM sort WHERE sort.id = student.student_type)AS student_type, " +
            "   student.name, " +
            "   (SELECT sort.name FROM sort WHERE sort.id = student.sex)AS sex, " +
            "   (SELECT sort.name FROM sort WHERE sort.id = student.college)AS college, " +
            "   (SELECT sort.name FROM sort  WHERE sort.id = student.square)AS square, " +
            "   student.photo,student.telephone  " +
            "   FROM student " +
            "   WHERE student.account_id = #{accountId};")
    public Map<String,String> getStudentInformation(@Param("accountId")String accountId);
}
